﻿using Framework.Testing;

namespace WebCrawler.Tests
{
    public class CrawlerTestData : MockedTestData
    {
        private readonly string _startUrl;
        protected IUrlMatcher _urlMatcher;
        protected IHttpClient _httpClient;
        protected IUrlRepository _urlRepository;
        public string Url1 = "http://test.com/1";
        public string Url2 = "http://test.com/2";
        private PageInfo _resultHtml;

        public PageInfo ResultHtml { get { return _resultHtml; } }

        public IUrlRepository UrlRepository { get { return _urlRepository; } }

        public string StartUrl { get { return _startUrl; } }

        public IUrlMatcher UrlMatcher { get { return _urlMatcher; } }
        public IHttpClient HttpClient { get { return _httpClient; } }

        public CrawlerTestData(string startUrl)
        {
            _startUrl = startUrl;
            _resultHtml = PageInfo.Success(startUrl, "<a href='" + Url1 + "'></a> <a href='" + Url2 + "'></a>");
        }
    }

    public class CrawlerTestFixture<TData> : MockedTestFixture<TData> where TData : CrawlerTestData
    {
    }
}